package leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Ghost
 * Date: 14-5-31
 * Time: 下午7:27
 * To change this template use File | Settings | File Templates.
 */
public class Binary_tree_inorder_traversal {
    public void inTree(TreeNode root,List<Integer> list){
        if(root!=null){
            inTree(root.left,list);
            list.add(root.val);
            inTree(root.right,list);
        }
    }
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> list = new ArrayList<Integer>();
        if(root==null)
            return list;
        inTree(root.left,list);
        list.add(root.val);
        inTree(root.right,list);
        return list;
    }
    public static void main(String[] args){
        TreeNode node1 = null;

      Binary_tree_inorder_traversal solution6 = new Binary_tree_inorder_traversal();

        ArrayList<Integer> list = (ArrayList<Integer>) solution6.inorderTraversal(node1);
        for(Integer integer:list){
            System.out.println(integer);
        }
    }
}
